<!DOCTYPE html>
<html>
<head>
   <title>CSS Animations - animation-iteration-count: inherit</title>
   <link rel="author" title="Opera Software ASA" href="http://www.opera.com/">
   <link rel="help" href="http://dev.w3.org/csswg/css3-animations/#the-animation-iteration-count-property-">
   <meta name="flags" content="dom">
   <meta name="assert" content="The computed value of
   'animation-iteration-count' is the same as the specified value">
   <script src="/resources/testharness.js"></script>
   <script src="/resources/testharnessreport.js"></script>
   <style type="text/css">
      @keyframes grow {
         from {
            width: 100px;
         }
         to {
            width: 200px;
         }
      }
      div {
         width: 100px;
         height: 100px;
         background: red;
         animation-duration: 0.7s;
      }
      div > div {
         background: blue;
         animation-iteration-count: inherit;
      }
      .test {
         animation-iteration-count: 2;
      }
      .test, .test > div {
         animation-name: grow;
      }
   </style>
   <script type="text/javascript">
      setup({explicit_done:true});
      onload = function() {
         var testName = document.querySelector('title').firstChild.data;
         var divs = document.querySelectorAll('div');
         var log = document.querySelectorAll('p')[1].firstChild;
         function aboutEqual(observed, actual) {
            var maxDeviation = 0.1;
            return (Math.abs(observed - actual) < maxDeviation);
         }
         var timeout = setTimeout(function() {
            test(function(){assert_true(false);}, testName); done();
            log.data = 'FAIL';
         }, 2000);
         divs[1].addEventListener('animationend', function(evt) {
            clearTimeout(timeout);
            var passed = aboutEqual(evt.elapsedTime, 1.4);
            test(function(){assert_true(passed);}, testName); done();
            log.data = (passed ? 'PASS if the animation occurred.' : 'FAIL');
         });
         divs[0].className = 'test';
      }
   </script>
   <style>iframe{display:none}</style>
</head>
<body>
   <p>The blue square below should twice gradually grow into a wide rectangle
   before returning to its original size, and there should be no red.</p>
   <p>Testing...</p>
   <div>
      <div></div>
   </div>
</body>
</html>
